package com.kurumi.medical.log;

import java.io.IOException;
import java.util.Date;

import com.kurumi.medical.util.DateUtil;
import com.kurumi.medical.util.FileUtil;


public class ExceptionLog {
	
	private String logFilePath;

	private String logFileName;
	
	private String logContent;
	
	
	private Date logDateTime = new Date();
	
	private int times;


	public String getLogFileName() {
		return logFileName;
	}


	public void setLogFileName(String logFileName) {
		this.logFileName = logFileName;
	}


	public String getLogContent() {
		return logContent;
	}


	public void setLogContent(String logContent) {
		this.logContent = logContent;
	}


	public Date getLogDateTime() {
		return logDateTime;
	}


	public void setLogDateTime(Date logDateTime) {
		this.logDateTime = logDateTime;
	}


	public int getTimes() {
		return times;
	}


	public void setTimes(int times) {
		this.times = times;
	}
	
	public String getLogFilePath() {
		return logFilePath;
	}

	public void setLogFilePath(String logFilePath) {
		this.logFilePath = logFilePath;
	}
	
	public void writeLog(){
		StringBuffer data = new StringBuffer();
		data.append(DateUtil.dateFormat(DateUtil.DATE_TIME_FORMATE, this.logDateTime)+"====>" + this.logContent);
		if(this.logFileName == null){
			this.logFileName = DateUtil.dateFormat("yyyyMMddHHmmssssss", this.logDateTime) +"_error.log" ;
		}
		try {
			FileUtil.createOrEditFile(data.toString(), this.logFilePath, this.logFileName);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public void writeLog(String logContent, String LogFilePath, String logFileName) {
		StringBuffer data = new StringBuffer();
		data.append(DateUtil.dateFormat(DateUtil.DATE_TIME_FORMATE, logDateTime)+"====>" + logContent);
		if(logFileName == null){
			logFileName = DateUtil.dateFormat("yyyyMMddHHmmssssss", logDateTime) +"_error.log" ;
		}
		try {
			FileUtil.createOrEditFile(data.toString(), logFilePath, logFileName);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	
	
	
	
	
}











